// 封装防抖函数

function debounce(fn,delay =500) {
  // timer 是在闭包中
  let timer = null

  return function() {
    if (timer) {
      clearInterval(timer)
    }
    timer = setTimeout(() => {
      fn.apply(this,arguments)
      timer = null
    },delay);
  }
} 
// input1.addEventListener('keyup',debounce(() => {
//   console.log(input1.value);
// }),600)